package co.yixiang.mall.common.hystrix;


import co.yixiang.common.core.api.ApiResult;
import co.yixiang.mall.common.feign.RemoteMemberUserService;
import co.yixiang.mall.common.mall.domain.YxUser;
import co.yixiang.mall.common.mall.param.HLoginParam;
import co.yixiang.weixin.common.weixin.vo.LoginParam;
import co.yixiang.mall.common.mall.param.RegParam;
import co.yixiang.mall.common.mall.param.VerityParam;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 用户服务降级处理
 * @author yshop
 */
@Component
public class RemoteMemberUserFallbackFactory implements FallbackFactory<RemoteMemberUserService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteMemberUserFallbackFactory.class);

    @Override
    public RemoteMemberUserService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());

        return new RemoteMemberUserService()
        {
            @Override
            public ApiResult<YxUser> HLogin(HLoginParam loginParam) {
                return null;
            }

            @Override
            public void saveLoginOnUser(YxUser yxUser, String token) {

            }

            @Override
            public ApiResult<YxUser> wxappLogin(LoginParam loginParam) {
                return null;
            }

            @Override
            public ApiResult<YxUser> authLogin(String code, String spread) {
                return null;
            }

            @Override
            public ApiResult<String> register(RegParam param) {
                return null;
            }

            @Override
            public ApiResult<String> verify(VerityParam param) {
                return null;
            }

            @Override
            public ApiResult<YxUser> getUserInfo(String username) {
                return null;
            }

            @Override
            public YxUser getUserByUid(Long uid) {
                return null;
            }

            @Override
            public void updateById(YxUser yxUser) {

            }

            @Override
            public Map<Long, YxUser> getAllUserMap() {
                return null;
            }
        };
    }
}
